k=min(100,round(cell_nb/20))
dim_val=c(2,5,10,20,30,40,50,100,500,1000,dim_nb)
hub_nb = c()
for (i in 1:length(simul_pca)) {
  hub_nb <- c(hub_nb,pbapply::pbsapply(dim_val, FUN=function(x) hub_nb_dim(simul_pca[[i]],x,k,hub_scores[[i]],1,cell_nb)))
}

## Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
## detected tied distances to neighbors, see ?'BiocNeighbors-ties'

## Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
## detected tied distances to neighbors, see ?'BiocNeighbors-ties'

## Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
## detected tied distances to neighbors, see ?'BiocNeighbors-ties'

## Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
## detected tied distances to neighbors, see ?'BiocNeighbors-ties'

## Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
## detected tied distances to neighbors, see ?'BiocNeighbors-ties'

## Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
## detected tied distances to neighbors, see ?'BiocNeighbors-ties'

## Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
## detected tied distances to neighbors, see ?'BiocNeighbors-ties'

## Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
## detected tied distances to neighbors, see ?'BiocNeighbors-ties'

## Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
## detected tied distances to neighbors, see ?'BiocNeighbors-ties'

## Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
## detected tied distances to neighbors, see ?'BiocNeighbors-ties'

## Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
## detected tied distances to neighbors, see ?'BiocNeighbors-ties'

hub_nb <- data.frame("Hub_nb" = hub_nb)
hub_nb$Dimension <- dim_val
hub_nb$Dropout <- factor(rep(dropout_percent, each=length(dim_val)))
ggplot(hub_nb, aes(x=Dimension, y=Hub_nb, color=Dropout)) +
  geom_point() +
  geom_line(aes(group=Dropout), lty=2) +
  ylim(0,max(hub_nb$Hub_nb))